import request from '@/utils/request'
import global from '@/global'

export function fetchListProgram(query) {

  // console.log("fetchListProgram-list");

  return request({
    // url: '/vue-admin-template/article/jiemd',
    baseURL:global.VUE_APP_BASE_API_STB,

    url: 'edu/getProgramList',
    method: 'get',
    // params: query
  })
}

export function fetchList(idate) {
  return request({
    baseURL:global.VUE_APP_BASE_API_STB,

    // url: '/vue-admin-template/article/list',
    url: 'edu/getVList',
    method: 'get',
    params: {idate}
  })
}

export function fetchArticle(id) {
  return request({
    baseURL:global.VUE_APP_BASE_API_STB,

    url: '/vue-admin-template/article/detail',
    method: 'get',
    params: { id }
  })
}

export function fetchPv(pv) {
  return request({
    baseURL:global.VUE_APP_BASE_API_STB,

    url: '/vue-admin-template/article/pv',
    method: 'get',
    params: { pv }
  })
}

export function createArticle(data) {
  return request({
    baseURL:global.VUE_APP_BASE_API_STB,
    // url: '/vue-admin-template/article/create',
    url: 'edu/createVideoTape',
    method: 'post',
    header: {'Content-Type':'application/x-www-form-urlencoded'},
    data
  })
}

export function updateArticle(data) {
  return request({
    baseURL:global.VUE_APP_BASE_API_STB,

    // url: '/vue-admin-template/article/update',
    url: 'edu/updateVideoTape',
    method: 'post',
    data
  })
}

export function updateProgramList(data) {
  return request({
    baseURL:global.VUE_APP_BASE_API_STB,

    // url: '/vue-admin-template/article/update',
    url: 'edu/updateCarouseDate',
    method: 'post',
    data
  })
}


export  function delProgramList(id) {
  return request({
    baseURL:global.VUE_APP_BASE_API_STB,

    url: 'edu/delCarouseDate',
    method: 'get',
    params: {id}
  })
}

export  function delVideoTape(id) {
  return request({
    baseURL:global.VUE_APP_BASE_API_STB,

    url: 'edu/delVideoTape',
    method: 'get',
    params: {id}
  })
}

/**
 * 批量更新排序id
 * @param data
 * @return {AxiosPromise}
 */
export  function updateBatchOfSortid(data) {
  return request({
    baseURL:global.VUE_APP_BASE_API_STB,
    url: 'edu/updateBatchOfSortid',
    method: 'post',
    data
  })
}
